package crossrun.tool.pdf2img.control;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExeThreadServics {
    ExecutorService cachedThreadPool;

    public static ExeThreadServics obtain() {
        return InnerHolder.service;
    }

    public void run(Runnable runnable){
        cachedThreadPool.submit(runnable);
    }

    private ExeThreadServics() {
        this.cachedThreadPool = Executors.newCachedThreadPool();
    }

    public ExecutorService getCachedThreadPool() {
        return cachedThreadPool;
    }

    private static class InnerHolder {
        private static ExeThreadServics service = new ExeThreadServics();
    }
}
